import {Records} from "@/api/product/trademark/type.ts";

export interface BaseType {
    code: number,
    message: string,
    ok: boolean
}

export interface SpuData {
    id?: number,
    spuName: string,
    description: string,
    category3Id: string | number,
    tmId: number | string,// 品牌ID，所属哪个品牌
    saleAttrList: SaleAttr[] | null, // 销售属性
    spuImageList: SPUImage[] | null      // 图片
}

export interface ResData extends BaseType {
    data: {
        records: SpuData[],
        total: number,
        size: number,
        current: number,
        searchCount: boolean,
        pages: number
    }
}

// 品牌数据返回类型
export interface ResTradeMark extends BaseType {
    data: Records
}

// SPU照片
export interface SPUImage {
    id?: number,
    createTime?: string,
    updateTime?: string,
    spuId?: number,
    imgName?: string,
    imgUrl?: string,
    name?:string,
    url?:string
}

// 返回SPU照片的类型
export interface ResSPUImgType extends BaseType {
    data: SPUImage[]
}

// 销售属性值
export interface SaleAttrValue {
    id?: number
    createTime?: string,
    updateTime?: string,
    spuId?: number,
    baseSaleAttrId: number,
    saleAttrValueName: string,
    saleAttrName?: string,
    isChecked?: null
}

// 销售属性
export interface SaleAttr {
    id?: number
    createTime?: string,
    updateTime?: string,
    spuId?: number,
    baseSaleAttrId: number,
    saleAttrName: string,
    spuSaleAttrValueList: SaleAttrValue[],
    flag?:boolean // 控制属性值输入框是否显示
    saleAttrValue?:string
}

// 返回的销售属性
export interface ResSaleAttrType extends BaseType {
    data: SaleAttr[]
}

// 所有SPU销售属性，下拉框使用
export interface CurrentSaleAttr {
    id: number,
    name: string
}

// 返回所有的销售属性
export interface ResAllSaleAttr extends BaseType {
    data:CurrentSaleAttr[]
}

